//
//  ZZIAPCodeHander.h
//  zz-IAPHelper
//
//  Created by ZengLiZhi on 2024/4/3.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, ZZIAPRequestCode) {
    ZZIAPRequestCode_NotAllow = 5,      // 不允许内购
    ZZIAPRequestCode_NoProduct = 6,      // 没匹配到内购商品
    
    ZZIAPRequestCode_Success = 0,       // 购买成功
    ZZIAPRequestCode_Failed = 1,        // 购买失败
    ZZIAPRequestCode_Cancel = 2,        // 取消购买
    ZZIAPRequestCode_Restored = 3,     // 重复购买
    
    ZZIAPRequestCode_RestoredSuccess = 100,    // 恢复购买成功
    ZZIAPRequestCode_RestoredEmpty = 101,    // 没有恢复购买的项目
    ZZIAPRequestCode_RestoredFailed = 102,    // 恢复购买失败
    
};

typedef void(^ZZIAPsendReceiptCompletion)(BOOL isSuccess,NSString *orderId);

@interface ZZIAPHander : NSObject

@property (nonatomic, strong) NSString *tip_success;
@property (nonatomic, strong) NSString *tip_failed;
@property (nonatomic, strong) NSString *tip_cancel;
@property (nonatomic, strong) NSString *tip_notAllow;

- (void)handleCode:(ZZIAPRequestCode)code;

//发送交易凭证to后端
- (void)sendReceiptToServerWithPayType:(NSString *)type
                             isRestore:(BOOL)isRestore
                               orderId:(NSString *)orderId
                            receiptStr:(NSString *)receiptStr
                 transactionIdentifier:(NSString *)transactionIdentifier
                            completion:(ZZIAPsendReceiptCompletion)completion;
@end

NS_ASSUME_NONNULL_END
